﻿using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Text;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userID"] != null)
        {
            //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script language=javascript>window.setTimeout(window.location.href = 'Default.aspx' ,5000);</script>");
            Response.Redirect("Home.aspx");
        }
        Session["where"] = this.ToString();
        InitializeWeb();
    }
    private void InitializeWeb()
    {
        //initial+flooor image
        this.Controls.AddAt(0, new LiteralControl(@"
          <html xmlns='http://www.w3.org/1999/xhtml' >
            <head runat='server'>
                <title>Sync Home Page</title>
                <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
                <style type='text/css'></style>
                <link href='css/css1.css' rel='stylesheet' type='text/css' />
            </head>
            <body align='center'>
            "));
        this.Controls.Add(new LiteralControl(@"
            <img src= '" + GlobalVar.imageLogo + @"' width='80' height='80' class='logo'>
            <font size='2' color='#FFFFFF' style='position:absolute; top:100px; left:110px;'><b>Sync Web Portal</b></font>
            "));
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        using (SqlConnection connection = new SqlConnection())
        {
            connection.ConnectionString = GlobalVar.ConnString;
            connection.Open();
            // Use the connection
            using (SqlCommand command = new SqlCommand())
            {
                command.CommandText = "SELECT * FROM Accounts";
                command.Connection = connection;
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    StringBuilder sb = new StringBuilder();
                    while (reader.Read())
                    {
                    }
                }
            }
            connection.Close();
        }
    }
}
